//
//  MainCarCollectionViewCell.m
//  19--Homework 汽车之家
//
//  Created by 冀永金 on 16/8/10.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "MainCarCollectionViewCell.h"
#import "CarMainModel.h"
#import "UIImageView+WebCache.h"
@interface MainCarCollectionViewCell ()
@property (nonatomic, strong) UIImageView *image;
@property (nonatomic, strong) UILabel *nameLabel;
@end
@implementation MainCarCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [[UIImageView alloc]init];
        [self.contentView addSubview:_image];
      //  _image.backgroundColor = [UIColor yellowColor];
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:_nameLabel];
        self.nameLabel.textAlignment = 1;
        //_nameLabel.backgroundColor = [UIColor blueColor];

    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.image.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.width);
    self.nameLabel.frame = CGRectMake(0, self.bounds.size.width + 15, self.bounds.size.width, 50);
    
}
- (void)setCarModel:(CarMainModel *)carModel {
    _carModel = carModel;
    self.nameLabel.text = carModel.seriesname;
    [self.image sd_setImageWithURL:[NSURL URLWithString:carModel.img] placeholderImage:[UIImage imageNamed:@"concise_icon_favorite_normal"]];
}
@end
